<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section 2.8.&nbsp; Primitive System Data Types</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/team.gif" width="60" height="17" border="0" align="absmiddle"  alt="Team BBL"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch02lev1sec7.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<a href=ch02lev1sec9.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a name="ch02lev1sec8"></a>
<h3 class="docSection1Title">2.8. Primitive System Data Types</h3>
<p class="docText">Historically, certain C data types have been associated with certain UNIX system variables. For example, the major and minor device numbers have historically been stored in a 16-bit short integer, with 8 bits for the major device number and 8 bits for the minor device number. But many larger systems need more than 256 values for these device numbers, so a different technique is needed. (Indeed, Solaris uses 32 bits for the device number: 14 bits for the major and 18 bits for the minor.)</P>
<p class="docText">The header <tt>&lt;sys/types.h&gt;</tt> defines some implementation-dependent data types, called the <span class="docEmphasis">primitive system data types</span>. More of these data types are defined in other headers also. These data types are defined in the headers with the C <tt>typedef</tt> facility. Most end in <tt>_t</tt>. <a class="docLink" href="#ch02fig20">Figure 2.20</a> lists many of the primitive system data types that we'll encounter in this text.</P>
<a name="ch02fig20"></a><p><table cellspacing="0" class="allBorders" border="1" RULES="groups" cellpadding="5"><caption><H5 class="docTableTitle">Figure 2.20. Some common primitive system data types</H5></caption><colgroup><col width="150"><col width="350"></colgroup><thead><TR><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Type</span></p></th><th class="bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Description</span></P></th></TR></thead><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>caddr_t</tt></P></td><TD class="docTableCell" align="left" valign="top"><p class="docText">core address (<a class="docLink" href="ch14lev1sec9.html#ch14lev1sec9">Section 14.9</a>)</P></TD></tr><TR><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>clock_t</tt></p></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">counter of clock ticks (process time) (<a class="docLink" href="ch01lev1sec10.html#ch01lev1sec10">Section 1.10</a>)</p></td></tr><tr><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>comp_t</tt></p></TD><td class="docTableCell" align="left" valign="top"><p class="docText">compressed clock ticks (<a class="docLink" href="ch08lev1sec14.html#ch08lev1sec14">Section 8.14</a>)</P></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>dev_t</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">device numbers (major and minor) (<a class="docLink" href="ch04lev1sec23.html#ch04lev1sec23">Section 4.23</a>)</p></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>fd_set</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">file descriptor sets (<a class="docLink" href="ch14lev1sec5.html#ch14lev2sec14">Section 14.5.1</a>)</p></td></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>fpos_t</tt></P></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">file position (<a class="docLink" href="ch05lev1sec10.html#ch05lev1sec10">Section 5.10</a>)</p></TD></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>gid_t</tt></P></td><TD class="docTableCell" align="left" valign="top"><p class="docText">numeric group IDs</P></TD></tr><TR><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>ino_t</tt></p></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">i-node numbers (<a class="docLink" href="ch04lev1sec14.html#ch04lev1sec14">Section 4.14</a>)</p></td></tr><tr><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>mode_t</tt></p></TD><td class="docTableCell" align="left" valign="top"><p class="docText">file type, file creation mode (<a class="docLink" href="ch04lev1sec5.html#ch04lev1sec5">Section 4.5</a>)</P></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>nlink_t</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">link counts for directory entries (<a class="docLink" href="ch04lev1sec14.html#ch04lev1sec14">Section 4.14</a>)</p></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>off_t</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">file sizes and offsets (signed) (<tt>lseek</tt>, <a class="docLink" href="ch03lev1sec6.html#ch03lev1sec6">Section 3.6</a>)</p></td></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>pid_t</tt></P></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">process IDs and process group IDs (signed) (<a class="docLink" href="ch08lev1sec2.html#ch08lev1sec2">Sections 8.2</a> and <a class="docLink" href="ch09lev1sec4.html#ch09lev1sec4">9.4</a>)</p></TD></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>ptrdiff_t</tt></P></td><TD class="docTableCell" align="left" valign="top"><p class="docText">result of subtracting two pointers (signed)</P></TD></tr><TR><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>rlim_t</tt></p></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">resource limits (<a class="docLink" href="ch07lev1sec11.html#ch07lev1sec11">Section 7.11</a>)</p></td></tr><tr><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>sig_atomic_t</tt></p></TD><td class="docTableCell" align="left" valign="top"><p class="docText">data type that can be accessed atomically (<a class="docLink" href="ch10lev1sec15.html#ch10lev1sec15">Section 10.15</a>)</P></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>sigset_t</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">signal set (<a class="docLink" href="ch10lev1sec11.html#ch10lev1sec11">Section 10.11</a>)</p></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>size_t</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">sizes of objects (such as strings) (unsigned) (<a class="docLink" href="ch03lev1sec7.html#ch03lev1sec7">Section 3.7</a>)</p></td></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>ssize_t</tt></P></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">functions that return a count of bytes (signed) (<tt>read</tt>, <tt>write</tt>, <a class="docLink" href="ch03lev1sec7.html#ch03lev1sec7">Section 3.7</a>)</p></TD></TR><TR><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>time_t</tt></P></td><TD class="docTableCell" align="left" valign="top"><p class="docText">counter of seconds of calendar time (<a class="docLink" href="ch01lev1sec10.html#ch01lev1sec10">Section 1.10</a>)</P></TD></tr><TR><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>uid_t</tt></p></TD><TD class="docTableCell" align="left" valign="top"><p class="docText">numeric user IDs</p></td></tr><tr><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>wchar_t</tt></p></TD><td class="docTableCell" align="left" valign="top"><p class="docText">can represent all distinct character codes</P></td></tr></table></p><br>
<p class="docText">By defining these data types this way, we do not build into our programs implementation details that can change from one system to another. We describe what each of these data types is used for when we encounter them later in the text.</p>

<a href="17021535.html"><img src="images/pixel.gif" alt="" width="1" height="1" border="0"></a><ul></ul></td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/team.gif" width="60" height="17" border="0" align="absmiddle"  alt="Team BBL"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch02lev1sec7.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<a href=ch02lev1sec9.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
</body></html><br>
<table width="100%" cellspacing="0" cellpadding="0"
style="margin-top: 0pt; border-collapse: collapse;"> 
<tr> <td align="right" style="background-color=white; border-top: 1px solid gray;"> 
<a href="http://www.zipghost.com/" target="_blank" style="font-family: Tahoma, Verdana;
 font-size: 11px; text-decoration: none;">The CHM file was converted to HTM by Trial version of <b>ChmD<!--107-->ecompiler</b>.</a>
</TD>
</TR><tr>
<td align="right" style="background-color=white; "> 
<a href="http://www.etextwizard.com/download/cd/cdsetup.exe" target="_blank" style="font-family: Tahoma, Verdana;
 font-size: 11px; text-decoration: none;">Download <b>ChmDec<!--107-->ompiler</b> at: http://www.zipghost.com</a>
</TD></tr></table>
